//递归求斐波那契数列的第 N 项

import java.util.Scanner;

public class Test24 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请斐波那契数列的项数：");
        int num=scanner.nextInt();
        int s=func(num);
        System.out.println("斐波那契数列的第"+num+"项为"+s);
    }

    private static int func(int num) {
        if(num==1||num==2){
            return 1;
        }else{
            return func(num-1)+func(num-2);
        }
    }
}
